package com.terrynoya.fight.stateMachine.triggers
{
	import com.terrynoya.fight.char.Character;
	import com.terrynoya.fight.stateMachine.StateController;
	import com.terrynoya.fight.stateMachine.controllers.attrParser.StateCtrlParserType;
	
	public class AttackDist extends StateController
	{
		private var _distance:int;
		
		public function AttackDist(name:String)
		{
			super(name);
		}
		
		override protected function initAttrConvertMap():void
		{
			this.attrConvertMap.put("value",StateCtrlParserType.Expression);
		}
		
		override public function run(character:Character):void
		{
			if(!this.hasExpression("value"))
			{
				return;
			}
			this._distance = this.excuteExpression("value",character);
			
			if(!character.offensiveInfo.activeHitDef)
			{
				return;
			}
			character.offensiveInfo.hitDef.guardDistance = this._distance;
		}
	}
}